package com.sumainfor.pc.gmio.controller.secretary;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.PageUtils;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.pc.gmio.service.SeBillOutlayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 服务秘书 业主的水电燃账单列表
 */
@RestController
@RequestMapping("/secretary/SeBillOutlay")
public class SeBillOutlayController implements Serializable {

    @Autowired
    private SeBillOutlayService seBillOutlayService;
    /**
     * 服务秘书查询业主的水电燃账单列表
     * @param params
     * @param pager
     * @return
     */
    @GetMapping("/getSeBillOutlayList")
    public JsonResult getSeBillOutlayList(@RequestParam Map<String,Object> params, Pager pager){
        JsonResult result=new JsonResult();
        pager.setPagerNecessary(params, pager);
        PageUtils pageUtils = new PageUtils();
        Integer cout=seBillOutlayService.getSeBillOutlayListCount(params);
        if(cout==0){
            return pageUtils.getJsonResult(new ArrayList<Map<String,Object>>(), params,cout);
        }
        List<Map<String,Object>> getCommunityList=seBillOutlayService.getSeBillOutlayList(params);
        result=pageUtils.getJsonResult(getCommunityList, params, cout);
        return result;
    }
    /**
     * 租后主管撤回账单
     */
    @PostMapping("/updateSeBillDelfg")
    public JsonResult updateSeBillDelfg(@RequestBody  Map<String,Object>params){
        System.out.println("接收到的参数:"+params);
        return seBillOutlayService.updateSeBillDelfg(params);
    }
}
